package m2team.com.zuatet;

import java.util.ArrayList;

import m2team.com.zuatet.game.MemoryActivity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.TextView;

public class MainActivity extends Activity implements OnItemClickListener {

	TextView txt_header_days;
	ListView listView;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		initView();
	}


	private void initView() {
		//list view
		listView = (ListView) findViewById(R.id.list_item_main);
		ArrayList<Item> items = Common.getMainItem(this);
		CustomListAdapter adapter = new CustomListAdapter(this, items);
		listView.setAdapter(adapter);
		listView.setOnItemClickListener(this);
		//text days
		txt_header_days = (TextView) findViewById(R.id.txt_header_days);
		txt_header_days.setText(getString(R.string.days).toUpperCase());
		Common.setFont(this, txt_header_days, m2team.com.zuatet.Common.ROBOTO_BOLD);
	}
	

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.
		int id = item.getItemId();
		if (id == R.id.action_settings) {
			return true;
		}
		return super.onOptionsItemSelected(item);
	}


	
	@Override
	public void onItemClick(AdapterView<?> parent, View view, int position,
			long id) {
			if (position == 3) {
				Intent intent = new Intent(MainActivity.this, MemoryActivity.class);
				startActivity(intent);
			}
	}
}
